trigger FeadbackTrigger on Feedback__c(before insert,before update ) {
    
    Set<Id> woSet = new Set<Id>();
    for (Feedback__c fb  :  trigger.new ) {
    	
    	if(fb.WorkOrder__c != null )woSet.add(fb.WorkOrder__c);

    }
    Map<Id,String> woMap = new Map<Id,String>();
   	for ( WorkOrder__c wo : [select Id,Case__r.Servicetype__c,UserDepartmentContact__r.MobilePhone, Contact__r.MobilePhone from WorkOrder__c where Id in:woSet]) {
    	woMap.put(wo.Id, wo.Case__r.Servicetype__c  == '工程' ? wo.UserDepartmentContact__r.MobilePhone : wo.Contact__r.MobilePhone);
    } 

     for (Feedback__c fb  :  trigger.new ) {
    	
    	fb.PhoneNumber__c = woMap.get(fb.WorkOrder__c);

    }


}